import Vue from 'vue'
import VueRouter from 'vue-router'
import LayOut from '@/views/layout'
import Home from '@/views/Home'
import Search from '@/views/Search'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/layout' },
  // layout 路由规则 
  {
    path: '/layout',
    component: LayOut,
    redirect: '/layout/home',
    children: [
      // 主页 路由规则
      {name:'home', path: 'home', component: Home, meta:{title:'首页'} },

      // 搜索 路由规则
      { path: 'search', component: Search,meta:{title:'搜索'} }
    ]
  },

]

const router = new VueRouter({
  routes
})

export default router
